package com.xiaoguozi.starter;


import com.xiaoguozi.core.ClassScanner;
import com.xiaoguozi.web.handler.HandlerManager;
import com.xiaoguozi.web.server.TomcatServer;

import java.util.List;

public class MiniApplication {
    public static void run(Class<?> cls, String[] args) {
        System.out.println("Hello mini-spring!");
        TomcatServer tomcatServer = new TomcatServer(args);
        try {
            tomcatServer.startServer();
            List<Class<?>> classList = ClassScanner.scanClasses(cls.getPackageName());
            HandlerManager.initHandlerMapping(classList);
            
            classList.forEach(c -> System.out.println(c.getName()));
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
